<admintpl file="header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:U('Admin/Guest/add',array('live_id'=>$live_id))}">添加竞猜题目</a></li>
    </ul>
    <form class="js-ajax-form" action="" method="post">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
            	<th>序号</th>
                <th>竞猜题目</th>
                <th>创建时间</th>
                <th>总参与人数</th>
                <th>总投注数量</th>
                <th>结果选项</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo" key="keys">
                <tr>
                	<td>{$keys+1}</td>
                    <td>{$vo.quiz_name}</td>
                    <td>{$vo.created_at}</td>
                    <td>{$vo.num}</td>
                    <td>{$vo.total_amount}</td>
                    <td>{$vo.rule_name}</td>
                    <td>
                        <if condition="$vo.is_quiz eq 0">
                        <a href='{:U("Admin/Guest/delete",array("quiz_id"=>$vo["quiz_id"],"live_id"=>$live_id))}' class="js-ajax-dialog-btn"
                           data-msg="确定要删除此题目吗？">删除</a>
                        <else/>
                            <a style="color: #d3d4d4;">删除</a>
                        </if>
                        <if condition="$vo.is_quiz eq 0 || $status neq 4">
                            <a href="{:U('Admin/Guest/add',array('id'=>$vo['quiz_id']))}">编辑</a>
                            <else/>
                            <a style="color: #d3d4d4;">编辑</a>
                        </if>
                        <if condition="$vo.rule_name eq ''">
                            <a href="#" onclick="setFull('{$vo.quiz_id}','{$live_id}')">公布结果</a>
                        <else/>
                            <a style="color: #d3d4d4;">公布结果</a>
                        </if>
                        <a href="#" onclick="setDetail('{$vo.quiz_id}')">详情</a>
                        <a href="{:U('Admin/Guest/joinManage',array('id'=>$vo['quiz_id']))}">参与人数</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
    <div class="pagination">{$page}</div>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>

</body>
</html>
<script>
    function setFull(quiz_id,live_id){
        layer.open({
            type: 2,
            //skin: 'layui-layer-lan',
            title: '通栏设置',
            fix: false,
            shadeClose: true,
            maxmin: true,
            area: ['1000px', '500px'],
            content: "<?php if($_SERVER['SERVER_NAME'] == 'fzadmin.xinhuiwen.com') { echo U('Admin/Guest/setFull')?>"+'&id='+quiz_id+"&live_id="+live_id+"<?php ;}else{echo U('Admin/Guest/setFull')?>"+'&id='+quiz_id+"&live_id="+live_id+"<?php ;}?>",
            end: function(){
                location.reload();
            }
        });
    }

    function setDetail(quiz_id){
        layer.open({
            type: 2,
            //skin: 'layui-layer-lan',
            title: '通栏设置',
            fix: false,
            shadeClose: true,
            maxmin: true,
            area: ['1000px', '500px'],
            content: "<?php if($_SERVER['SERVER_NAME'] == 'fzadmin.xinhuiwen.com') { echo U('Admin/Guest/setDetail')?>"+'&id='+quiz_id+"<?php ;}else{echo U('Admin/Guest/setDetail')?>"+'&id='+quiz_id+"<?php ;}?>",
            end: function(){
                location.reload();
            }
        });
    }
</script>